// 生产环境的webpack配置文件
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
    mode:"production",
    entry:path.resolve(process.cwd(),"./src/index.js"), // 入口文件
    output:{
        path:path.resolve(process.cwd(),"./dist"),
        filename:"[name].js"
    },
    plugins: [
        new HtmlWebpackPlugin({
             title: "admin",
             filename: "index.html",
             template: "./public/index.html"
       }),
       new CopyWebpackPlugin({
             patterns: [{
                 from: "public",
                  to: "./",
                  globOptions: {
                     ignore: ["**/index.html"] // 排除index.html
                  }
            }]
        }) 
     ]
}